<template>
 <view class="incomeStatistics">
  <view class="index">
	  <view class="nav d_f j_c_c a_i_c">
	  	<view class="text">Project income/day</view>
	  	<image src="../../static/ct_0022_返回键深色.png" mode="" class="right" @tap="back"></image>
	  </view>
	   <view class="title">Invite obtain：{{invite}}USDT</view>
	  <view class="header d_f j_c_s_a a_i_c">
		  <view class="width d_f j_c_c">Date</view>
		  <view class="width1 d_f j_c_c">Friend Level</view>
		  <view class="width d_f j_c_c">Obtain</view>
	  </view>
	  <view class="box">
		  <view v-for="(item,index) in records" :key="index" class="records d_f j_c_s_a a_i_c">
			<view class="width d_f j_c_c">{{item.createtime}}</view>
			<view class="width1 d_f j_c_c">1</view>
			<view class="width d_f j_c_c">+{{item.money}}u</view>  
		  </view>
	  </view>
  </view>
 </view>
</template>

<script>
	import moment from '../../utils/moment.js'
 export default {
   data () {
     return {
       records:[],
       model:{
       		   page:1,
       		   pagesize:30,
       },
       total:0,
	   invite:0
     }
   },
   components: {

   },
   methods: {
     back(){
     	uni.navigateBack({
     		delta: 1
     	});
     },
	 //获取数据
	 getData(){
	 		this.$api.getRecommendrulelog(this.model).then(res=>{
	 			res.data.rows.map(item=>{
	 				item.createtime=moment(item.createtime).format('YYYY-MM-DD')
	 			})
	 			 this.records=this.records.concat(res.data.rows)
	 			 this.total=res.data.total
				 this.invite=res.data.allMoney
	 		}) 
	 }
   },
   onLoad() {
 this.getData()
   },
   onPullDownRefresh(){
   	   if(this.model.page*this.model.pagesize<this.total){
   		   this.records=[]
   		   this.model.page+=1
   		   this.getData() 
   	   }
   },
   watch: {

   },
   computed: {

   }
 }
</script>

<style scoped lang='scss'>
.incomeStatistics{
	width: 100%;
	min-height: 100%;
	background: rgb(239, 237, 238);
	.index{
		width: calc(100% - 64rpx);
		margin-left: 32rpx;
		height: 100%;
		padding-bottom: 32rpx;
		.nav {
			width: 100%;
			height: 160rpx;
			
			position: relative;
		    z-index: 9999;
			.text {
				font-size: 32rpx;
				font-weight: 700;
			color: #000;
			}
		
			.right {
				width: 20rpx;
				height: 32rpx;
				position: absolute;
				left: 0rpx;
				z-index: 999;
				transform: rotate(180deg);
			}
		}
		.title{
			margin: 32rpx 0rpx;
			font-weight: 700;
		}
		.header{
			width: 100%;
			height: 100rpx;
			background: #3dcc86;
			border-radius: 20rpx 20rpx 0rpx 0rpx;
			color: #fff;
			font-size: 24rpx;
		}
		.width{
			width: 150rpx;
		}
		.width1{
			width: 200rpx;
		}
		.box{
			width: 100%;
			background: #FFFFFF;
			border-radius: 0rpx 0rpx 20rpx 20rpx;
			
			.records{
				height: 120rpx;
				border-bottom: 1rpx solid #ccc;
				font-size: 28rpx;
			}
		}
	}
}
</style>